package com.haohan.stock.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.haohan.stock.service.StockService;

@Controller
@RequestMapping(value = "/")
public class IndexController {
	
	@Autowired
	private StockService stockService;
	

	@RequestMapping(value = "/{code}/{scale}")
	public String getCustomerList(@PathVariable("code")String code,@PathVariable("scale")int scale,ModelMap map) {
		map.addAttribute("stockdata_list",stockService.selectAll(code,scale));
		return "table";
	}
	
	@RequestMapping(value = "/result/{day}/{scale}")
	public String getResult(@PathVariable("day")String day,@PathVariable("scale")int scale,ModelMap map) {
		map.addAttribute("stockdata_list",stockService.selectResult(day,scale));
		return "result";
	}

}